package com.yxjwzpx.management.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.yxjwzpx.management.domain.MaintainCompany;
import com.yxjwzpx.management.mapper.MaintainCompanyMapper;
import com.yxjwzpx.management.service.IMaintainCompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 维保公司Service业务层处理
 * 
 * @author yxjwzpx
 * @date 2025-04-09
 */
@Service
public class MaintainCompanyServiceImpl implements IMaintainCompanyService 
{
    @Autowired
    private MaintainCompanyMapper maintainCompanyMapper;

    /**
     * 查询维保公司
     * 
     * @param companyId 维保公司主键
     * @return 维保公司
     */
    @Override
    public MaintainCompany selectMaintainCompanyByCompanyId(Long companyId)
    {
        return maintainCompanyMapper.selectMaintainCompanyByCompanyId(companyId);
    }

    /**
     * 查询维保公司列表
     * 
     * @param maintainCompany 维保公司
     * @return 维保公司
     */
    @Override
    public List<MaintainCompany> selectMaintainCompanyList(MaintainCompany maintainCompany)
    {
        return maintainCompanyMapper.selectMaintainCompanyList(maintainCompany);
    }

    /**
     * 新增维保公司
     * 
     * @param maintainCompany 维保公司
     * @return 结果
     */
    @Override
    public int insertMaintainCompany(MaintainCompany maintainCompany)
    {
        maintainCompany.setCreateTime(DateUtils.getNowDate());
        return maintainCompanyMapper.insertMaintainCompany(maintainCompany);
    }

    /**
     * 修改维保公司
     * 
     * @param maintainCompany 维保公司
     * @return 结果
     */
    @Override
    public int updateMaintainCompany(MaintainCompany maintainCompany)
    {
        maintainCompany.setUpdateTime(DateUtils.getNowDate());
        return maintainCompanyMapper.updateMaintainCompany(maintainCompany);
    }

    /**
     * 批量删除维保公司
     * 
     * @param companyIds 需要删除的维保公司主键
     * @return 结果
     */
    @Override
    public int deleteMaintainCompanyByCompanyIds(Long[] companyIds)
    {
        return maintainCompanyMapper.deleteMaintainCompanyByCompanyIds(companyIds);
    }

    /**
     * 删除维保公司信息
     * 
     * @param companyId 维保公司主键
     * @return 结果
     */
    @Override
    public int deleteMaintainCompanyByCompanyId(Long companyId)
    {
        return maintainCompanyMapper.deleteMaintainCompanyByCompanyId(companyId);
    }

    @Override
    public Long selectCompanyIdByUserId(Long userId) {
        return maintainCompanyMapper.selectCompanyIdByUserId(userId);
    }
}
